<?php
// File Security Check
if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && basename( __FILE__ ) == basename( $_SERVER['SCRIPT_FILENAME'] ) ) :
	die ( 'You do not have sufficient permissions to access this page!' );
endif;

/* Template Name: Blog */

get_header(); ?>

<?php

if ( get_query_var( 'paged' ) ) :
	$paged = get_query_var( 'paged' );
elseif ( get_query_var( 'page' ) ) :
	$paged = get_query_var( 'page' );
else :
	$paged = 1;
endif;

query_posts( array( 'post_type' => 'post', 'paged' => $paged ) ); ?>

<hgroup class="page-head">

	<header class="main-title col-full">
		<div class="left">
			<h1 class="entry-title"><?php the_title(); ?></h1>
		</div>
	</header>

</hgroup>

<!-- BEGIN #container -->
<div id="container" class="clearfix">

<!-- BEGIN #content -->
<section id="content" class="<?php echo $post->post_name; ?>">

<?php if ( have_posts() ) : ?>

		<?php while ( have_posts() ) : the_post(); ?>

			<!-- BEGIN .post -->
			<article class="post clearfix">

				 <?php if ( has_post_thumbnail() ) :	?>
						<figure class="featured-image view view-more">
							<a href="<?php the_permalink(); ?>" title="<?php printf( __( 'Permanent Link to %s', 'nicethemes' ), get_the_title() ); ?>">
								<?php nice_image( array( 'width' => 480, 'height' => 480, 'class' => 'wp-post-image' ) ); ?>
								<div class="mask"></div>
							</a>
						</figure>
				<?php endif; ?>

				<header>
					<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( __( 'Permanent Link to %s', 'nicethemes' ), get_the_title() ); ?>"><?php the_title(); ?></a></h2>
			<?php nice_post_meta(); ?>
				</header>

				<div class="entry">

					<div class="post-content">
						<?php nice_excerpt( 400 ); ?>
					</div>

				</div>

				<a class="readmore" href="<?php echo get_permalink( get_the_ID() ); ?>" title="<?php printf( __( 'Permanent Link to %s', 'nicethemes' ), get_the_title() ); ?>"><?php _e( 'Read More', 'nicethemes' ); ?></a>

			<!-- END .post -->
			</article>

		<?php endwhile; ?>

<?php else : ?>

			<?php _e( 'Sorry, no posts matched your criteria.', 'nicethemes' ); ?>

<?php endif; ?>

<?php nice_pagenavi(); ?>

<!-- END #content -->
</section>

<?php get_sidebar(); ?>

<!-- END #container -->
</div>

<?php get_footer(); ?>